package com.ibm.cloud.banking.parameter.pricing.service;

import com.ibm.cloud.banking.parameter.pricing.entity.PrpFeeCfrmRule;
import com.ibm.cloud.banking.parameter.pricing.entity.ResultVo;
import com.ibm.cloud.banking.parameter.pricing.facade.IFeeCfrmRuleService;
import com.ibm.cloud.banking.parameter.pricing.repo.PrpFeeCfrmRuleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class FeeCfrmRuleServiceImpl implements IFeeCfrmRuleService {

    @Autowired
    private PrpFeeCfrmRuleMapper prpFeeCfrmRuleMapper;
    /**
     * 根据条件查询决定费率种类
     *
     * @param prpFeeCfrmRule
     * @return
     */
    @Override
    public ResultVo<List<PrpFeeCfrmRule>> findFeeCodeOfFeeCfrmRuleByCondition(PrpFeeCfrmRule prpFeeCfrmRule) {
        ResultVo<List<PrpFeeCfrmRule>> resultVo = new ResultVo<List<PrpFeeCfrmRule>>();
        resultVo.setResultCode("00000");
        resultVo.setResultMsg("成功!");
        resultVo.setData(null);
        List<PrpFeeCfrmRule> prpFeeCfrmRuleList = prpFeeCfrmRuleMapper
                .findPrpFeeCfrmRuleListByCondition(prpFeeCfrmRule);
        if (StringUtils.isEmpty(prpFeeCfrmRuleList)) {
            resultVo.setResultCode("90001");
            resultVo.setResultMsg("没有查询到数据!");
            return resultVo;
        }
        resultVo.setData(prpFeeCfrmRuleList);
        return resultVo;
    }
}
